#!/bin/bash
#

echo "================================================================="
echo "Install iptables ($SERVER_NAME): begin"

source $COMMON_FUNC > /dev/null 2>&1
if [ $? -gt 0 ]; then
    echo "Error: This script requires common-func.bash"
    exit 1
fi

isRoot

IPTABLES=/etc/sysconfig/iptables

echo "Backing up $IPTABLES"
backup $IPTABLES

if [ ! $? -eq 0 ]
then
    echo "Error: Encountered error in backing up of $IPTABLES. Procedure exit."
else 
    rm -Rf $IPTABLES
    cp $RESOURCES_DIR/system/iptables /etc/sysconfig/iptables
    echo "Restarting iptables"
    service iptables restart
fi

echo "Install iptables: done"
echo "================================================================="
